import java.util.ArrayList;
import java.util.Collections;
import java.util.function.Consumer;
import java.util.function.Function;

public class Test06 {
    public static void main(String[] args) {
        ArrayList<String> list=new ArrayList<>();
        Collections.addAll(list,"张无忌-15","周芷若-14","赵敏-15","张强-20","张三丰-100","张翠山-40","王二麻子-37");
        list.stream().map(new Function<String,Integer>(){
            @Override
            public Integer apply(String s){
                String[] arr=s.split("-");
                String ageString=arr[1];
                int age=Integer.parseInt(ageString);
                return age;

            }
        }).forEach(new Consumer<Integer>(){
            @Override
            public void accept(Integer i){
                System.out.println(i);
            }
        });
        System.out.println("===========");
        list.stream().map(s->Integer.parseInt((s.split("-")[1])))
                .forEach(s->System.out.println(s));
    }
}
